package fr.mgdis.observatoir;


import java.util.ArrayList;
import fr.mgdis.metier.Observatoir;
import fr.mgdis.webService.WebService;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;
public class ChoixObservatoirActivity extends ListActivity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
	  super.onCreate(savedInstanceState);
	  ArrayList<Observatoir> listP = WebService.getAListOfObservatoir();
	  ArrayList<String> listlibelleObs=WebService.getAListLibelleOfObservatoir(listP);
	  setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, listlibelleObs));

	  ListView lv = getListView();
	  lv.setTextFilterEnabled(true);

	  lv.setOnItemClickListener(new OnItemClickListener() {
	        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
	        	 Intent intent = new Intent(ChoixObservatoirActivity.this, ObservatoirActivity.class);
	 		     startActivity(intent);
	        }
	    });
	}
	}
